-
Notifications
You must be signed in to change notification settings - Fork 48
[JExtract] Generate JNI code for memory management with SwiftKitCore
#302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SwiftKitCore
SwiftKitCore
Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+SwiftThunkPrinting.swift
Outdated
Show resolved
Hide resolved
Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaBindingsPrinting.swift
Show resolved
Hide resolved
@@ -40,8 +41,10 @@ static void examples() { | |||
|
|||
MySwiftClass.method(); | |||
|
|||
MySwiftClass myClass = MySwiftClass.init(10, 5); | |||
MySwiftClass myClass2 = MySwiftClass.init(); | |||
try (var arena = new ConfinedSwiftMemorySession(Thread.currentThread())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick that this may want to be SwiftArena.ofConfined()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, but the problem is that Java 7 does not support static methods on interfaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh... heh I wonder if we need to really support so long back, we'll see as we chat with android workgroup.
Otherwise the Java pattern is to do a type like SwiftArenas
that's a class and put the static methods on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least we can make a ()
constructor that gets the current thread as well then, we can do this in a follow up
Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaBindingsPrinting.swift
Show resolved
Hide resolved
SwiftKitCore
SwiftKitCore
Adds SwiftKitCore support for the generated code for classes. This means that we will actually destroy the instances once the arena decides to so.